<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width,initial-scale=1">
  <meta name="generator" content="VuePress 2.0.0-beta.62">
  <style>
    :root {
      --c-bg: #fff;
    }

    html.dark {
      --c-bg: #22272e;
    }

    html,
    body {
      background-color: var(--c-bg);
    }
  </style>
  <script>
    const userMode = localStorage.getItem('vuepress-color-scheme');
    const systemDarkMode = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
    if (userMode === 'dark' || (userMode !== 'light' && systemDarkMode)) {
      document.documentElement.classList.toggle('dark', true);
    }
  </script>
  <link rel="icon" href="/favicon.jpg">
  <title>标准化统一返回对象 | 您好， 欢迎查看 HZY 文档 ！</title>
  <meta name="description" content="HZY 开源项目文档网站！">
  <link rel="preload" href="/docs/assets/style-961b9d5d.css" as="style">
  <link rel="stylesheet" href="/docs/assets/style-961b9d5d.css">
  <link rel="modulepreload" href="/docs/assets/app-4f4af2d5.js">
  <link rel="modulepreload" href="/docs/assets/api-result.html-f90b60b9.js">
  <link rel="modulepreload" href="/docs/assets/api-result.html-f2682747.js">
  <link rel="prefetch" href="/docs/assets/index.html-28072875.js" as="script">
  <link rel="prefetch" href="/docs/assets/code-gen.html-4397c299.js" as="script">
  <link rel="prefetch" href="/docs/assets/home.html-3fb3b3b2.js" as="script">
  <link rel="prefetch" href="/docs/assets/ioc-aop.html-0144cd72.js" as="script">
  <link rel="prefetch" href="/docs/assets/scheduled-tasks.html-bedcb769.js" as="script">
  <link rel="prefetch" href="/docs/assets/user-info.html-8578df40.js" as="script">
  <link rel="prefetch" href="/docs/assets/home.html-013ddfd3.js" as="script">
  <link rel="prefetch" href="/docs/assets/dbs.html-9052a8ef.js" as="script">
  <link rel="prefetch" href="/docs/assets/efcore.html-ec28f7d0.js" as="script">
  <link rel="prefetch" href="/docs/assets/sql.html-fe3eac11.js" as="script">
  <link rel="prefetch" href="/docs/assets/work.html-fe7c2daa.js" as="script">
  <link rel="prefetch" href="/docs/assets/simple.html-54212753.js" as="script">
  <link rel="prefetch" href="/docs/assets/split.html-e759ef21.js" as="script">
  <link rel="prefetch" href="/docs/assets/client.html-f2da1493.js" as="script">
  <link rel="prefetch" href="/docs/assets/download.html-903adac5.js" as="script">
  <link rel="prefetch" href="/docs/assets/problem.html-1c845052.js" as="script">
  <link rel="prefetch" href="/docs/assets/api.html-caba109f.js" as="script">
  <link rel="prefetch" href="/docs/assets/authorize.html-37a2ba6f.js" as="script">
  <link rel="prefetch" href="/docs/assets/data.html-578c517a.js" as="script">
  <link rel="prefetch" href="/docs/assets/api-check-model.html-b5cf845e.js" as="script">
  <link rel="prefetch" href="/docs/assets/api-resource-cache.html-f627996b.js" as="script">
  <link rel="prefetch" href="/docs/assets/request-limit.html-79d7eb18.js" as="script">
  <link rel="prefetch" href="/docs/assets/404.html-f9875e7b.js" as="script">
  <link rel="prefetch" href="/docs/assets/index.html-f24f1c0d.js" as="script">
  <link rel="prefetch" href="/docs/assets/code-gen.html-9aef4a31.js" as="script">
  <link rel="prefetch" href="/docs/assets/home.html-287156bf.js" as="script">
  <link rel="prefetch" href="/docs/assets/ioc-aop.html-c387c913.js" as="script">
  <link rel="prefetch" href="/docs/assets/scheduled-tasks.html-b338f70f.js" as="script">
  <link rel="prefetch" href="/docs/assets/user-info.html-8f482e6a.js" as="script">
  <link rel="prefetch" href="/docs/assets/home.html-7cba3ecd.js" as="script">
  <link rel="prefetch" href="/docs/assets/dbs.html-4250b788.js" as="script">
  <link rel="prefetch" href="/docs/assets/efcore.html-c2834bdb.js" as="script">
  <link rel="prefetch" href="/docs/assets/sql.html-e0d45a22.js" as="script">
  <link rel="prefetch" href="/docs/assets/work.html-6d0ca231.js" as="script">
  <link rel="prefetch" href="/docs/assets/simple.html-80586b86.js" as="script">
  <link rel="prefetch" href="/docs/assets/split.html-7a328015.js" as="script">
  <link rel="prefetch" href="/docs/assets/client.html-0c7bcd45.js" as="script">
  <link rel="prefetch" href="/docs/assets/download.html-27f039c3.js" as="script">
  <link rel="prefetch" href="/docs/assets/problem.html-9ef68938.js" as="script">
  <link rel="prefetch" href="/docs/assets/api.html-8c3a828a.js" as="script">
  <link rel="prefetch" href="/docs/assets/authorize.html-be0e89f8.js" as="script">
  <link rel="prefetch" href="/docs/assets/data.html-0f889ade.js" as="script">
  <link rel="prefetch" href="/docs/assets/api-check-model.html-8aaab178.js" as="script">
  <link rel="prefetch" href="/docs/assets/api-resource-cache.html-465cb7e9.js" as="script">
  <link rel="prefetch" href="/docs/assets/request-limit.html-c85ce0aa.js" as="script">
  <link rel="prefetch" href="/docs/assets/404.html-ee2a0c1c.js" as="script">
</head>

<body>
  <div id="app"><!--[-->
    <div class="theme-container"><!--[-->
      <header class="navbar">
        <div class="toggle-sidebar-button" title="toggle sidebar" aria-expanded="false" role="button" tabindex="0">
          <div class="icon" aria-hidden="true"><span></span><span></span><span></span></div>
        </div><span><a href="/docs/" class=""><!----><span class="site-name">您好， 欢迎查看 HZY 文档 ！</span></a></span>
        <div class="navbar-items-wrapper" style=""><!--[--><!--]-->
          <nav class="navbar-items can-hide"><!--[-->
            <div class="navbar-item"><a class="external-link" href="https://www.bilibili.com/video/BV1tt4y157qH/"
                rel="noopener noreferrer" target="_blank" aria-label="视频讲解"><!--[--><!--]--> 视频讲解 <span><svg
                    class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"
                    x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15">
                    <path fill="currentColor"
                      d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z">
                    </path>
                    <polygon fill="currentColor"
                      points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9">
                    </polygon>
                  </svg><span class="external-link-icon-sr-only">open in new window</span></span><!--[--><!--]--></a>
            </div>
            <div class="navbar-item"><a href="/docs/guide/others/home.md" class="" aria-label="其他项目"><!--[--><!--]-->
                其他项目 <!--[--><!--]--></a></div>
            <div class="navbar-item"><a class="external-link" href="http://124.221.128.7:5600/"
                rel="noopener noreferrer" target="_blank" aria-label="HzyAdmin 预览"><!--[--><!--]--> HzyAdmin 预览
                <span><svg class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"
                    focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15">
                    <path fill="currentColor"
                      d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z">
                    </path>
                    <polygon fill="currentColor"
                      points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9">
                    </polygon>
                  </svg><span class="external-link-icon-sr-only">open in new window</span></span><!--[--><!--]--></a>
            </div>
            <div class="navbar-item"><a class="external-link" href="https://gitee.com/hzy6" rel="noopener noreferrer"
                target="_blank" aria-label="gitee"><!--[--><!--]--> gitee <span><svg class="external-link-icon"
                    xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px"
                    viewBox="0 0 100 100" width="15" height="15">
                    <path fill="currentColor"
                      d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z">
                    </path>
                    <polygon fill="currentColor"
                      points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9">
                    </polygon>
                  </svg><span class="external-link-icon-sr-only">open in new window</span></span><!--[--><!--]--></a>
            </div>
            <div class="navbar-item"><a class="external-link" href="https://github.com/hzy-6" rel="noopener noreferrer"
                target="_blank" aria-label="github"><!--[--><!--]--> github <span><svg class="external-link-icon"
                    xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px"
                    viewBox="0 0 100 100" width="15" height="15">
                    <path fill="currentColor"
                      d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z">
                    </path>
                    <polygon fill="currentColor"
                      points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9">
                    </polygon>
                  </svg><span class="external-link-icon-sr-only">open in new window</span></span><!--[--><!--]--></a>
            </div><!--]-->
          </nav><!--[--><!--]--><button class="toggle-color-mode-button" title="toggle color mode"><svg style=""
              class="icon" focusable="false" viewBox="0 0 32 32">
              <path d="M16 12.005a4 4 0 1 1-4 4a4.005 4.005 0 0 1 4-4m0-2a6 6 0 1 0 6 6a6 6 0 0 0-6-6z"
                fill="currentColor"></path>
              <path d="M5.394 6.813l1.414-1.415l3.506 3.506L8.9 10.318z" fill="currentColor"></path>
              <path d="M2 15.005h5v2H2z" fill="currentColor"></path>
              <path d="M5.394 25.197L8.9 21.691l1.414 1.415l-3.506 3.505z" fill="currentColor"></path>
              <path d="M15 25.005h2v5h-2z" fill="currentColor"></path>
              <path d="M21.687 23.106l1.414-1.415l3.506 3.506l-1.414 1.414z" fill="currentColor"></path>
              <path d="M25 15.005h5v2h-5z" fill="currentColor"></path>
              <path d="M21.687 8.904l3.506-3.506l1.414 1.415l-3.506 3.505z" fill="currentColor"></path>
              <path d="M15 2.005h2v5h-2z" fill="currentColor"></path>
            </svg><svg style="display:none;" class="icon" focusable="false" viewBox="0 0 32 32">
              <path
                d="M13.502 5.414a15.075 15.075 0 0 0 11.594 18.194a11.113 11.113 0 0 1-7.975 3.39c-.138 0-.278.005-.418 0a11.094 11.094 0 0 1-3.2-21.584M14.98 3a1.002 1.002 0 0 0-.175.016a13.096 13.096 0 0 0 1.825 25.981c.164.006.328 0 .49 0a13.072 13.072 0 0 0 10.703-5.555a1.01 1.01 0 0 0-.783-1.565A13.08 13.08 0 0 1 15.89 4.38A1.015 1.015 0 0 0 14.98 3z"
                fill="currentColor"></path>
            </svg></button><!---->
        </div>
      </header><!--]-->
      <div class="sidebar-mask"></div><!--[-->
      <aside class="sidebar">
        <nav class="navbar-items"><!--[-->
          <div class="navbar-item"><a class="external-link" href="https://www.bilibili.com/video/BV1tt4y157qH/"
              rel="noopener noreferrer" target="_blank" aria-label="视频讲解"><!--[--><!--]--> 视频讲解 <span><svg
                  class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"
                  x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15">
                  <path fill="currentColor"
                    d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z">
                  </path>
                  <polygon fill="currentColor"
                    points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9">
                  </polygon>
                </svg><span class="external-link-icon-sr-only">open in new window</span></span><!--[--><!--]--></a>
          </div>
          <div class="navbar-item"><a href="/docs/guide/others/home.md" class="" aria-label="其他项目"><!--[--><!--]--> 其他项目
              <!--[--><!--]--></a></div>
          <div class="navbar-item"><a class="external-link" href="http://124.221.128.7:5600/" rel="noopener noreferrer"
              target="_blank" aria-label="HzyAdmin 预览"><!--[--><!--]--> HzyAdmin 预览 <span><svg
                  class="external-link-icon" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"
                  x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15">
                  <path fill="currentColor"
                    d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z">
                  </path>
                  <polygon fill="currentColor"
                    points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9">
                  </polygon>
                </svg><span class="external-link-icon-sr-only">open in new window</span></span><!--[--><!--]--></a>
          </div>
          <div class="navbar-item"><a class="external-link" href="https://gitee.com/hzy6" rel="noopener noreferrer"
              target="_blank" aria-label="gitee"><!--[--><!--]--> gitee <span><svg class="external-link-icon"
                  xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px"
                  viewBox="0 0 100 100" width="15" height="15">
                  <path fill="currentColor"
                    d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z">
                  </path>
                  <polygon fill="currentColor"
                    points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9">
                  </polygon>
                </svg><span class="external-link-icon-sr-only">open in new window</span></span><!--[--><!--]--></a>
          </div>
          <div class="navbar-item"><a class="external-link" href="https://github.com/hzy-6" rel="noopener noreferrer"
              target="_blank" aria-label="github"><!--[--><!--]--> github <span><svg class="external-link-icon"
                  xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px"
                  viewBox="0 0 100 100" width="15" height="15">
                  <path fill="currentColor"
                    d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z">
                  </path>
                  <polygon fill="currentColor"
                    points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9">
                  </polygon>
                </svg><span class="external-link-icon-sr-only">open in new window</span></span><!--[--><!--]--></a>
          </div><!--]-->
        </nav><!--[--><!--]-->
        <ul class="sidebar-items"><!--[-->
          <li><a href="/docs/guide/hzy-admin/home.md" class="sidebar-item sidebar-heading active collapsible"
              aria-label="HzyAdmin"><!--[--><!--]--> HzyAdmin <!--[--><!--]--></a>
            <ul style="" class="sidebar-item-children"><!--[-->
              <li><a href="/docs/guide/hzy-admin/home.md" class="sidebar-item" aria-label="欢迎使用"><!--[--><!--]--> 欢迎使用
                  <!--[--><!--]--></a><!----></li>
              <li><a href="/docs/guide/hzy-admin/user-info.md" class="sidebar-item"
                  aria-label="获取登陆人信息"><!--[--><!--]--> 获取登陆人信息 <!--[--><!--]--></a><!----></li>
              <li><a href="/docs/guide/hzy-admin/scheduled-tasks.md" class="sidebar-item"
                  aria-label="定时任务"><!--[--><!--]--> 定时任务 <!--[--><!--]--></a><!----></li>
              <li><a href="/docs/guide/hzy-admin/code-gen.md" class="sidebar-item" aria-label="代码生成"><!--[--><!--]-->
                  代码生成 <!--[--><!--]--></a><!----></li>
              <li><a href="/docs/guide/hzy-admin/ioc-aop.md" class="sidebar-item"
                  aria-label="自动 IOC 注入 和 AOP"><!--[--><!--]--> 自动 IOC 注入 和 AOP <!--[--><!--]--></a><!----></li>
              <li>
                <p tabindex="0" class="sidebar-item collapsible">数据库 <span class="right arrow"></span></p>
                <ul style="display:none;" class="sidebar-item-children"><!--[-->
                  <li><a href="/docs/guide/hzy-admin/database/efcore.md" class="sidebar-item"
                      aria-label="EFCore 初始化数据库"><!--[--><!--]--> EFCore 初始化数据库 <!--[--><!--]--></a><!----></li>
                  <li><a href="/docs/guide/hzy-admin/database/sql.md" class="sidebar-item"
                      aria-label="SQL 初始化数据库"><!--[--><!--]--> SQL 初始化数据库 <!--[--><!--]--></a><!----></li>
                  <li><a href="/docs/guide/hzy-admin/database/dbs.md" class="sidebar-item"
                      aria-label="多数据源"><!--[--><!--]--> 多数据源 <!--[--><!--]--></a><!----></li>
                  <li><a href="/docs/guide/hzy-admin/database/work.md" class="sidebar-item"
                      aria-label="事务，延迟提交"><!--[--><!--]--> 事务，延迟提交 <!--[--><!--]--></a><!----></li><!--]-->
                </ul>
              </li>
              <li>
                <p tabindex="0" class="sidebar-item collapsible">部署 <span class="right arrow"></span></p>
                <ul style="display:none;" class="sidebar-item-children"><!--[-->
                  <li><a href="/docs/guide/hzy-admin/deployment/split.md" class="sidebar-item"
                      aria-label="前后端分离部署"><!--[--><!--]--> 前后端分离部署 <!--[--><!--]--></a><!----></li>
                  <li><a href="/docs/guide/hzy-admin/deployment/simple.md" class="sidebar-item"
                      aria-label="整体部署"><!--[--><!--]--> 整体部署 <!--[--><!--]--></a><!----></li><!--]-->
                </ul>
              </li>
              <li>
                <p tabindex="0" class="sidebar-item collapsible">权限 <span class="right arrow"></span></p>
                <ul style="display:none;" class="sidebar-item-children"><!--[-->
                  <li><a href="/docs/guide/hzy-admin/permission/authorize.md" class="sidebar-item"
                      aria-label="授权验证"><!--[--><!--]--> 授权验证 <!--[--><!--]--></a><!----></li>
                  <li><a href="/docs/guide/hzy-admin/permission/data.md" class="sidebar-item"
                      aria-label="数据权限"><!--[--><!--]--> 数据权限 <!--[--><!--]--></a><!----></li>
                  <li><a href="/docs/guide/hzy-admin/permission/api.md" class="sidebar-item"
                      aria-label="接口权限"><!--[--><!--]--> 接口权限 <!--[--><!--]--></a><!----></li><!--]-->
                </ul>
              </li>
              <li>
                <p tabindex="0" class="sidebar-item active collapsible">WebApi <span class="down arrow"></span></p>
                <ul style="" class="sidebar-item-children"><!--[-->
                  <li><a href="/docs/guide/hzy-admin/web-api/api-check-model.md" class="sidebar-item"
                      aria-label="模型验证"><!--[--><!--]--> 模型验证 <!--[--><!--]--></a><!----></li>
                  <li><a href="/docs/guide/hzy-admin/web-api/api-result.md" class="sidebar-item active"
                      aria-label="统一返回"><!--[--><!--]--> 统一返回 <!--[--><!--]--></a><!----></li>
                  <li><a href="/docs/guide/hzy-admin/web-api/api-resource-cache.md" class="sidebar-item"
                      aria-label="缓存特性"><!--[--><!--]--> 缓存特性 <!--[--><!--]--></a><!----></li>
                  <li><a href="/docs/guide/hzy-admin/web-api/request-limit.md" class="sidebar-item"
                      aria-label="限流特性"><!--[--><!--]--> 限流特性 <!--[--><!--]--></a><!----></li><!--]-->
                </ul>
              </li>
              <li>
                <p tabindex="0" class="sidebar-item collapsible">其他 <span class="right arrow"></span></p>
                <ul style="display:none;" class="sidebar-item-children"><!--[-->
                  <li><a href="/docs/guide/hzy-admin/others/client.md" class="sidebar-item"
                      aria-label="前端运行及说明"><!--[--><!--]--> 前端运行及说明 <!--[--><!--]--></a><!----></li>
                  <li><a href="/docs/guide/hzy-admin/others/download.md" class="sidebar-item"
                      aria-label="前端下载文件"><!--[--><!--]--> 前端下载文件 <!--[--><!--]--></a><!----></li>
                  <li><a href="/docs/guide/hzy-admin/others/problem.md" class="sidebar-item"
                      aria-label="更多问题"><!--[--><!--]--> 更多问题 <!--[--><!--]--></a><!----></li><!--]-->
                </ul>
              </li><!--]-->
            </ul>
          </li>
          <li>
            <p tabindex="0" class="sidebar-item sidebar-heading collapsible">其他项目 <span class="right arrow"></span></p>
            <ul style="display:none;" class="sidebar-item-children"><!--[-->
              <li><a href="/docs/guide/others/home.md" class="sidebar-item" aria-label="介绍"><!--[--><!--]--> 介绍
                  <!--[--><!--]--></a><!----></li><!--]-->
            </ul>
          </li><!--]-->
        </ul><!--[--><!--]-->
      </aside><!--]--><!--[-->
      <main class="page"><!--[--><!--]-->
        <div class="theme-default-content"><!--[--><!--]-->
          <div>
            <h1 id="标准化统一返回对象" tabindex="-1"><a class="header-anchor" href="#标准化统一返回对象" aria-hidden="true">#</a>
              标准化统一返回对象</h1>
            <div class="custom-container tip">
              <p class="custom-container-title">ApiResultFilter</p>
              <p>1、code = 200 为成功，500 为失败，401 为未授权</p>
              <p>2、message 返回一段字符串消息文本</p>
              <p>3、data 返回你的业务数据</p>
            </div>
            <blockquote>
              <p>返回值统一格式如下：</p>
            </blockquote>
            <div class="language-json line-numbers-mode" data-ext="json">
              <pre class="language-json"><code><span class="token punctuation">{</span>
    <span class="token property">&quot;code&quot;</span><span class="token operator">:</span> <span class="token number">200</span><span class="token punctuation">,</span>
    <span class="token property">&quot;message&quot;</span><span class="token operator">:</span> <span class="token string">&quot;请求成功&quot;</span><span class="token punctuation">,</span>
    <span class="token property">&quot;data&quot;</span><span class="token operator">:</span> <span class="token punctuation">{</span><span class="token punctuation">}</span>|<span class="token punctuation">[</span><span class="token punctuation">]</span>
<span class="token punctuation">}</span>
</code></pre>
              <div class="line-numbers" aria-hidden="true">
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
              </div>
            </div>
            <h2 id="_1、业务中返回业务消息" tabindex="-1"><a class="header-anchor" href="#_1、业务中返回业务消息" aria-hidden="true">#</a>
              1、业务中返回业务消息</h2>
            <div class="custom-container warning">
              <p class="custom-container-title">业务中返回业务消息</p>
              <p>我们通过 throw MessageBox.Show(&quot;请输入账户名!&quot;); 返回业务消息 , 更多的扩展代码请查看源代码。</p>
            </div>
            <div class="language-csharp line-numbers-mode" data-ext="cs">
              <pre class="language-csharp"><code><span class="token doc-comment comment">/// <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>summary</span><span class="token punctuation">&gt;</span></span></span>
<span class="token doc-comment comment">/// 检查账户 登录信息 并返回 token</span>
<span class="token doc-comment comment">/// <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>summary</span><span class="token punctuation">&gt;</span></span></span>
<span class="token doc-comment comment">/// <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>param</span> <span class="token attr-name">name</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>authUserFormDto<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>param</span><span class="token punctuation">&gt;</span></span></span>
<span class="token doc-comment comment">/// <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>returns</span><span class="token punctuation">&gt;</span></span>账户 id<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>returns</span><span class="token punctuation">&gt;</span></span></span>
<span class="token keyword">public</span> <span class="token keyword">virtual</span> <span class="token keyword">async</span> <span class="token return-type class-name">Task<span class="token punctuation">&lt;</span>Guid<span class="token punctuation">&gt;</span></span> <span class="token function">LoginAsync</span><span class="token punctuation">(</span><span class="token class-name">AuthUserFormDto</span> authUserFormDto<span class="token punctuation">)</span>
<span class="token punctuation">{</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token keyword">string</span><span class="token punctuation">.</span><span class="token function">IsNullOrWhiteSpace</span><span class="token punctuation">(</span>authUserFormDto<span class="token punctuation">.</span>UserName<span class="token punctuation">)</span><span class="token punctuation">)</span>
        MessageBox<span class="token punctuation">.</span><span class="token function">Show</span><span class="token punctuation">(</span><span class="token string">&quot;请输入账户名!&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

    <span class="token keyword">if</span> <span class="token punctuation">(</span><span class="token keyword">string</span><span class="token punctuation">.</span><span class="token function">IsNullOrWhiteSpace</span><span class="token punctuation">(</span>authUserFormDto<span class="token punctuation">.</span>UserPassword<span class="token punctuation">)</span><span class="token punctuation">)</span>
        MessageBox<span class="token punctuation">.</span><span class="token function">Show</span><span class="token punctuation">(</span><span class="token string">&quot;请输入密码！&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>

    <span class="token keyword">if</span> <span class="token punctuation">(</span>authUserFormDto<span class="token punctuation">.</span>UserPassword<span class="token punctuation">.</span>Length <span class="token operator">&lt;</span> <span class="token number">6</span><span class="token punctuation">)</span>
    <span class="token punctuation">{</span>
        MessageBox<span class="token punctuation">.</span><span class="token function">Show</span><span class="token punctuation">(</span><span class="token string">&quot;密码长度不能少于6位！&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>

    <span class="token keyword">if</span> <span class="token punctuation">(</span>authUserFormDto<span class="token punctuation">.</span>UserPassword<span class="token punctuation">.</span>Length <span class="token operator">&gt;</span> <span class="token number">20</span><span class="token punctuation">)</span>
    <span class="token punctuation">{</span>
        MessageBox<span class="token punctuation">.</span><span class="token function">Show</span><span class="token punctuation">(</span><span class="token string">&quot;密码长度不能大于20位！&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>

    <span class="token comment">// if (string.IsNullOrWhiteSpace(code))</span>
    <span class="token comment">//  throw MessageBox.Show(&quot;请输入验证码!&quot;);</span>

    <span class="token class-name"><span class="token keyword">var</span></span> sysUser <span class="token operator">=</span> <span class="token keyword">await</span> _sysUserRepository<span class="token punctuation">.</span><span class="token function">FindAsync</span><span class="token punctuation">(</span>w <span class="token operator">=&gt;</span> w<span class="token punctuation">.</span>LoginName <span class="token operator">==</span> authUserFormDto<span class="token punctuation">.</span>UserName<span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token keyword">if</span> <span class="token punctuation">(</span>sysUser <span class="token operator">==</span> <span class="token keyword">null</span><span class="token punctuation">)</span>
    <span class="token punctuation">{</span>
        MessageBox<span class="token punctuation">.</span><span class="token function">Show</span><span class="token punctuation">(</span><span class="token string">&quot;账户或者密码错误!&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>

    <span class="token keyword">if</span> <span class="token punctuation">(</span>sysUser<span class="token punctuation">.</span>Password<span class="token punctuation">.</span><span class="token function">Trim</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">!=</span> Tools<span class="token punctuation">.</span><span class="token function">Md5Encrypt</span><span class="token punctuation">(</span>authUserFormDto<span class="token punctuation">.</span>UserPassword<span class="token punctuation">)</span><span class="token punctuation">)</span>
    <span class="token punctuation">{</span>
        MessageBox<span class="token punctuation">.</span><span class="token function">Show</span><span class="token punctuation">(</span><span class="token string">&quot;账户或者密码错误!&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
    <span class="token punctuation">}</span>

    <span class="token comment">//string code = Tools.GetCookie(&quot;loginCode&quot;);</span>
    <span class="token comment">//if (string.IsNullOrEmpty(code)) throw new MessageBox(&quot;验证码失效&quot;);</span>
    <span class="token comment">//if (!code.ToLower().Equals(loginCode.ToLower())) throw new MessageBox(&quot;验证码不正确&quot;);</span>

    <span class="token comment">//return _tokenService.CreateTokenByAccountId(sysUser.Id);</span>
    <span class="token keyword">return</span> sysUser<span class="token punctuation">.</span>Id<span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</code></pre>
              <div class="line-numbers" aria-hidden="true">
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
              </div>
            </div>
            <h2 id="_2、基类-admincontrollerbase-中默认带有-apiresultfilter-特性" tabindex="-1"><a class="header-anchor"
                href="#_2、基类-admincontrollerbase-中默认带有-apiresultfilter-特性" aria-hidden="true">#</a> 2、基类
              AdminControllerBase 中默认带有 [ApiResultFilter] 特性</h2>
            <div class="language-csharp line-numbers-mode" data-ext="cs">
              <pre class="language-csharp"><code>
<span class="token keyword">namespace</span> <span class="token namespace">HZY<span class="token punctuation">.</span>Api<span class="token punctuation">.</span>Admin<span class="token punctuation">.</span>Controllers</span><span class="token punctuation">;</span>

<span class="token doc-comment comment">/// <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>summary</span><span class="token punctuation">&gt;</span></span></span>
<span class="token doc-comment comment">/// 后台系统基础控制器</span>
<span class="token doc-comment comment">/// <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>summary</span><span class="token punctuation">&gt;</span></span></span>
<span class="token punctuation">[</span>ApiResultFilter<span class="token punctuation">]</span>
<span class="token punctuation">[</span><span class="token attribute"><span class="token class-name">Route</span><span class="token attribute-arguments"><span class="token punctuation">(</span>AdminControllerBase<span class="token punctuation">.</span>RoutePrefix <span class="token operator">+</span> <span class="token string">&quot;/[controller]/[action]&quot;</span><span class="token punctuation">)</span></span></span><span class="token punctuation">]</span>
<span class="token punctuation">[</span><span class="token attribute"><span class="token class-name">Authorize</span></span><span class="token punctuation">]</span><span class="token comment">//是否授权 Authorize</span>
<span class="token punctuation">[</span>ApiController<span class="token punctuation">]</span>
<span class="token keyword">public</span> <span class="token keyword">class</span> <span class="token class-name">AdminControllerBase</span> <span class="token punctuation">:</span> <span class="token type-list"><span class="token class-name">ControllerBase</span></span>
<span class="token punctuation">{</span>
    <span class="token doc-comment comment">/// <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>summary</span><span class="token punctuation">&gt;</span></span></span>
    <span class="token doc-comment comment">/// 路由前缀</span>
    <span class="token doc-comment comment">/// <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>summary</span><span class="token punctuation">&gt;</span></span></span>
    <span class="token keyword">public</span> <span class="token keyword">const</span> <span class="token class-name"><span class="token keyword">string</span></span> RoutePrefix <span class="token operator">=</span> <span class="token interpolation-string"><span class="token string">$&quot;/api/v1/admin&quot;</span></span><span class="token punctuation">;</span>

    <span class="token doc-comment comment">/// <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>summary</span><span class="token punctuation">&gt;</span></span></span>
    <span class="token doc-comment comment">/// 管理系统基础控制器构造函数</span>
    <span class="token doc-comment comment">/// <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>summary</span><span class="token punctuation">&gt;</span></span></span>
    <span class="token keyword">public</span> <span class="token function">AdminControllerBase</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span> <span class="token punctuation">}</span>
<span class="token punctuation">}</span>

<span class="token doc-comment comment">/// <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>summary</span><span class="token punctuation">&gt;</span></span></span>
<span class="token doc-comment comment">/// 后台系统基础控制器</span>
<span class="token doc-comment comment">/// <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>summary</span><span class="token punctuation">&gt;</span></span></span>
<span class="token doc-comment comment">/// <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>typeparam</span> <span class="token attr-name">name</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>TService<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span><span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>typeparam</span><span class="token punctuation">&gt;</span></span></span>
<span class="token keyword">public</span> <span class="token keyword">class</span> <span class="token class-name">AdminControllerBase<span class="token punctuation">&lt;</span>TService<span class="token punctuation">&gt;</span></span> <span class="token punctuation">:</span> <span class="token type-list"><span class="token class-name">AdminControllerBase</span></span> <span class="token keyword">where</span> <span class="token class-name">TService</span> <span class="token punctuation">:</span> <span class="token type-list"><span class="token keyword">class</span></span>
<span class="token punctuation">{</span>
    <span class="token doc-comment comment">/// <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>summary</span><span class="token punctuation">&gt;</span></span></span>
    <span class="token doc-comment comment">/// 默认服务</span>
    <span class="token doc-comment comment">/// <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>summary</span><span class="token punctuation">&gt;</span></span></span>
    <span class="token keyword">protected</span> <span class="token keyword">readonly</span> <span class="token class-name">TService</span> _defaultService<span class="token punctuation">;</span>

    <span class="token doc-comment comment">/// <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>summary</span><span class="token punctuation">&gt;</span></span></span>
    <span class="token doc-comment comment">/// 管理系统基础控制器构造函数</span>
    <span class="token doc-comment comment">/// <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>summary</span><span class="token punctuation">&gt;</span></span></span>
    <span class="token doc-comment comment">/// <span class="token tag"><span class="token tag"><span class="token punctuation">&lt;</span>param</span> <span class="token attr-name">name</span><span class="token attr-value"><span class="token punctuation attr-equals">=</span><span class="token punctuation">&quot;</span>defaultService<span class="token punctuation">&quot;</span></span><span class="token punctuation">&gt;</span></span>默认服务<span class="token tag"><span class="token tag"><span class="token punctuation">&lt;/</span>param</span><span class="token punctuation">&gt;</span></span></span>
    <span class="token keyword">public</span> <span class="token function">AdminControllerBase</span><span class="token punctuation">(</span><span class="token class-name">TService</span> defaultService<span class="token punctuation">)</span>
    <span class="token punctuation">{</span>
        _defaultService <span class="token operator">=</span> defaultService<span class="token punctuation">;</span>
    <span class="token punctuation">}</span>
<span class="token punctuation">}</span>


</code></pre>
              <div class="line-numbers" aria-hidden="true">
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
                <div class="line-number"></div>
              </div>
            </div>
          </div><!--[--><!--]-->
        </div>
        <footer class="page-meta"><!---->
          <div class="meta-item last-updated"><span class="meta-item-label">Last Updated: </span><!----></div>
          <div class="meta-item contributors"><span class="meta-item-label">Contributors: </span><span
              class="meta-item-info"><!--[--><!--[--><span class="contributor"
                title="email: 1396510655@qq.com">hzy</span><!----><!--]--><!--]--></span></div>
        </footer><!----><!--[--><!--]-->
      </main><!--]-->
    </div><!----><!--]-->
  </div>
  <script type="module" src="/docs/assets/app-4f4af2d5.js" defer></script>
</body>

</html>